<?php
$connect = mysqli_connect('localhost','root','root','student');
mysqli_set_charset($connect,'utf8');
if(!$connect){
    echo jsonReturn(2,'数据库连接失败');
    die;
}
function jsonReturn($code = 1, $msg = '', $data = [])
{
    $arr =
        [
            'code' => $code,
            'msg' => $msg,
            'data' => $data
        ];
    return json_encode($arr);
}